package tp1;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerThread {
	public static final int PORT = 8260;

	public static void main(String argv[]) {
		ServerSocket s = null;
		int conexCount = 0;
		try {
			s = new ServerSocket(PORT);
		} catch (IOException e) {
			System.out.println(e);
			System.exit(1);
		}
		while (true) {
			Socket client = null;
			conexCount++;
			System.out.println("waiting for connexion " + conexCount);
			try {
				client = s.accept();
			} catch (IOException e) {
				System.out.println(e);
				continue;
			}
			System.out.println("connexion established :" + conexCount);
			new SocketHandler(client).start();
		}
	}
}

